package com.tao.controller;


import com.tao.service.HotSearchService;
import com.tao.vo.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HotSearchController {
    @Autowired
    HotSearchService hotSearchService;
    //更新热搜前5
    @GetMapping("/hotSearch")
    public ResponseResult GetHotSearch() {
        return ResponseResult.okResult(hotSearchService.getHotList(null));
    }

    //添加热搜到redis
    @PutMapping("/hotSearch")
    public ResponseResult InsertHot(String history){
        hotSearchService.incrementScore(history);
        return ResponseResult.okResult(200,"操作成功");
    }
}

